<html xmlns:th="http://www.w3.org/1999/xhtml">
<div class="navbar navbar-default" th:fragment="nav">
    <div class="container">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle" data-toggle="collapse"
                    data-target=".navbar-collapse">
                <span class="icon-bar"></span> <span class="icon-bar"></span> <span
                    class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="/">小小商店</a>
        </div>
        <div class="navbar-collapse collapse">
            <ul class="nav navbar-nav">
                <li><a href="/">首页</a></li>
                <li><a href="/product/">商品</a></li>
                <li><a href="/news/">公告</a></li>
            </ul>
            <ul class="nav navbar-nav navbar-right" th:if="${session.login_user != null}">
                    <li class="dropdown">
                        <a class="dropdown-toggle" data-toggle="dropdown" href="#">
                            <p th:text="${session.login_user.username}">登录用户</p>
                        </a>
                        <ul class="dropdown-menu">
                            <li><a href="/user/profile">个人设置</a></li>
                            <li><a href="/user/logout">登出</a></li>
                        </ul>
                    </li>
            </ul>

            <ul class="nav navbar-nav navbar-right" th:unless="${session.login_user != null}">
                <li><a href="/user/login">登陆</a></li>
                <li><a href="/user/reg">注册</a></li>
            </ul>
            <form class="navbar-form navbar-right" role="cart">
                <a href="/cart/" class="btn btn-info">购物车</a>
            </form>
        </div>
        <!--/.nav-collapse -->
    </div>
</div>